<?php

ob_start();

?>
<div style="
	margin-left: 3em;
	margin-right: 1em;
	margin-bottom: 4em;
">
	<div style="
		margin-left: 2em;
	">
	
<?php
	
	$dataName = '';
	$dataEmail = '';
	$dataPassword = '';
	$dataGander = '';
	$dataUserIP = $_SERVER['REMOTE_ADDR'];
	$first = true;
	$valid = false;
	$errors = array();
	
if (isset($_POST['data-submit'])) 
{
	$first = false;
	$dataSender = @$_REQUEST['data-sender'];
	$dataMessage = @$_REQUEST['data-message'];
	
	
	if (preg_match('/(\\S)+@(\\S){5,}/us', $dataSender)
		|| (strlen(preg_replace('/[^0-9]/us', '', $dataSender)) >= 5)
	) 
	{
		$valid = true;	
	} 
	else
	{
		$errors['data-sender'] = 'Укажите, пожалуйста номер своего телефона или адресс электронной почты';
	}
	
	if ($valid)
	{

	}
	
}

if ((! $valid) || $first) 
{
?>
	<h3>Регистрация</h3>
	<form action="" method="POST">
	<p>
	<label>Имя:</label>
	<input type="text" id="data-name" name="data-name" value="<?php echo a($dataName);?>" />
	<?php 
	if (! empty($errors['data-name']))
	{
	?>
		<br /><span class="form-error"><?php echo t($errors['data-name']);?></span>
	<?php 
	}
	?>
	<br />
	
	<label>E-mail:</label>
	<input type="text" id="data-email" name="data-email" value="<?php echo a($dataEmail);?>" />
	<?php 
	if (! empty($errors['data-email']))
	{
	?>
		<br /><span class="form-error"><?php echo t($errors['data-email']);?></span>
	<?php 
	}
	?>
	<br />
	
	<label>Пароль:</label>
	<input type="password" id="data-password" name="data-password" value="" />
	<?php 
	if (! empty($errors['data-password']))
	{
	?>
		<br /><span class="form-error"><?php echo t($errors['data-password']);?></span>
	<?php 
	}
	?>
	<br />
	
	<label>Пол:</label>
	<select id="field-gander" name="field-gander">
	<?php 
	foreach (array(
		'' => '[не выбран]',
		'f' => 'мужской',
		'm' => 'женский',
	
	
	) as $value => $caption)
	{
		?><option value="<?php echo a($value);?>"<?php $value === $dataGander ? ' selected="1"' : '';?>><?php echo t($caption);?></option><?php 
	}
	
	?>
	</select>
	<br />
	
	<input type="submit" value="Зарегистрироваться" />
	
	</form>

<?php 	
}

?>

</div>
</div>

<?php

$content = ob_get_clean();

$noSendForm = true;

$pageTitle = "Зарегистрироваться";

?>